Skip to content

Add AES-PCBC known-answer tests from an independent reference - #32

Merged
dipu-bd merged 1 commit into
mainfrom
claude/project-thread-9loyrt
Nov 28, 2026
Merged

dipu-bd merged 1 commit into
mainfrom
claude/project-thread-9loyrt

Conversation

@dipu-bd

@dipu-bd dipu-bd commented Nov 28, 2026

Copy link
Copy Markdown
Member

Requested by Dipu · project thread

Summary

AES-PCBC had round-trip and stream tests but no known-answer tests. This adds a known inputs (independent reference) group to test/aes_pcbc_test.dart:

  • AES-128/192/256, NoPadding, 4-block message: encrypt and decrypt
  • AES-128, PKCS7, 30-byte message: encrypt and decrypt

Key, IV and plaintext come from NIST SP 800-38A Appendix F.2. PCBC has no published standard vectors, so the expected ciphertexts come from an independent implementation: the AES block from Python cryptography 50.0.1 (OpenSSL) with PCBC chaining written per Wikipedia (C_i = E_K(P_i ^ P_(i-1) ^ C_(i-1)), P_0 ^ C_0 = IV). The source is cited in the test. As a sanity check, the first block of each vector equals the matching SP 800-38A CBC first block.

cipherlib matched every vector with no code changes. No version bump, and no CHANGELOG entry because this is test-only.

KATs for Salsa20-Poly1305 and XSalsa20-Poly1305 are held back. Their construction is bespoke (it isn't NaCl secretbox), and its design is being discussed separately.

Verification

  • dart format --set-exit-if-changed .: clean
  • dart analyze --fatal-infos: no issues
  • dart test -p vm: 1,818 passed

Generated by Claude Code

@dipu-bd dipu-bd self-assigned this Nov 28, 2026
@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@dipu-bd
dipu-bd merged commit ea10111 into main Nov 28, 2026
18 checks passed
@dipu-bd
dipu-bd deleted the claude/project-thread-9loyrt branch November 28, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants